﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using ValidationFramework.Tests.Integration.Helpers;
namespace ValidationFramework.Tests.Integration.Validators
{
	[TestFixture]
	public class ValidatorAttributeTests
	{
		public class IPlatformDescendant : IPlatform
		{
			internal IPlatformDescendant()
			{
			}

			public int PlatformNumber { get; set; }
			public double StartPosition { get; set; }
			public double EndPosition { get; set; }
		}

		public interface IPlatform
		{
			[AlwaysFail]
			int PlatformNumber { get; set; }

			[AlwaysFail]
			double StartPosition { get; set; }

			[AlwaysFail]
			double EndPosition { get; set; }
		}

		[Test]
		public void Should_Honor_Rule_When_Specified_In_Attribute()
		{
			Validation.Initialize();

			var policy = Validation.GetValidationPolicy<IPlatformDescendant>(x => x.EndPosition);

			Assert.AreEqual(1, policy.RuleCount);
		}
	}
}
